import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/Home/Index',  // 重定向:重新指向其它path,会改变网址
  },
  {
    path: '/Home',
    name: 'Home',
    component: Home,
    children:[
      {
        path: '/Home/Index',
        name: 'Index',
        component: () => import('../views/Home/Index.vue')
      },
      {
        path: '/Home/Classify',
        name: 'Classify',
        component: () => import('../views/Home/Classify.vue')
      },
      {
        path: '/Home/Shop',
        name: 'Shop',
        component: () => import('../views/Home/Shop.vue')
      },
      {
        path: '/Home/Me',
        name: 'Me',
        component: () => import('../views/Home/Me.vue')
      },
    ]
  },
  {
    path: '/Detail/:id',
    name: 'Detail',
    component: () => import('../views/Detail.vue')
  },
  {
    path: '/Login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/about',
    name: 'About',
    component: () => import('../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
